﻿using System;
using System.Collections.Generic;

namespace Pay.DTO {
	/// <summary>
	/// 分页信息
	/// </summary>
	[Serializable]
	public class ApiPagedResult<T> : ApiResultMessage {
		public ApiPagedResult() { }
		public ApiPagedResult(List<T> rows, int total, int page, int size) {
			this.rows = rows;
			this.total_result = total;
			this.page = page;
			this.size = size;
		}
		/// <summary>
		/// 当前页
		/// </summary>
		public int page { get; set; }
		/// <summary>
		/// 当页N条
		/// </summary>
		public int size { get; set; }
		/// <summary>
		/// 总页数
		/// </summary>
		public int total_pages {
			get {
				if (total_result % size == 0)
					return total_result / size;
				return total_result / size + 1;
			}
		}
		/// <summary>
		/// 总记录数
		/// </summary>
		public int total_result { get; set; }

		/// <summary>
		/// 返回分页记录数据
		/// </summary>
		public List<T> rows { get; set; }
	}
}
